<section id="header" class="header">
	<div class="header-top">
		<div class="container">
			<div class="row">
				<div class="col-md-4">
					<ul class="flat-support">
						<li>
							<a href="javascript:;" title=""><ldbz:current_user_tag attr="username" ;user>
									<%if(user=="false"){%>
										游客 欢迎你！
									<%}else{%>
										${user}
									<%}%>
								</ldbz:current_user_tag></a>
						</li>
						<li>
							<a href="${request.contextPath}/sso/register" title="">免费注册</a>
						</li>
						<li>
							<a href="${request.contextPath}/sso/login" title="">会员登录</a>
						</li>
					</ul><!-- /.flat-support -->
				</div><!-- /.col-md-4 -->
				<div class="col-md-4">
					<ul class="flat-infomation">
						<li class="phone">
							联系客服: <a href="javascript:;" title="">(888) 1234 56789</a>
						</li>
					</ul><!-- /.flat-infomation -->
				</div><!-- /.col-md-4 -->
				<div class="col-md-4">
					<ul class="flat-unstyled">
						<li class="account">
							<a href="javascript:;" title="">我的淘宝<i class="fa fa-angle-down" aria-hidden="true"></i></a>
							<ul class="unstyled">
								<li>
									<ldbz:current_user_tag ;user>
										<%if(user=="false"){%>
											<a href="${request.contextPath}/sso/login" title="">登录</a>
										<%}else{%>
											<a href="${request.contextPath}/sso/logout" title="">退出</a>
										<%}%>
									</ldbz:current_user_tag>
								</li>
								<li>
									<a href="${request.contextPath}/cart" title="">购物车</a>
								</li>
								<li>
									<a href="${request.contextPath}/order" title="">我的订单</a>
								</li>
							</ul><!-- /.unstyled -->
						</li>
						<li>
							<a href="javascript:;" title="">简体中文<i class="fa fa-angle-down" aria-hidden="true"></i></a>
							<ul class="unstyled">
								<li>
									<a href="javascript:;" title="">English</a>
								</li>
								<li>
									<a href="javascript:;" title="">简体中文</a>
								</li>
							</ul><!-- /.unstyled -->
						</li>
					</ul><!-- /.flat-unstyled -->
				</div><!-- /.col-md-4 -->
			</div><!-- /.row -->
		</div><!-- /.container -->
	</div><!-- /.header-top -->
	<div class="header-middle">
		<div class="container">
			<div class="row">
				<div class="col-md-3">
					<div id="logo" class="logo">
						<a href="index" style="font-size:36px;font-family: STHeiti;color: #e08101;"> 分布式商城 </a>
					</div><!-- /#logo -->
				</div><!-- /.col-md-3 -->
				<div class="col-md-6">
					<div class="top-search">
						<form id="form_global_search" action="${request.contextPath}/search"  class="form-search" accept-charset="utf-8">
							<div class="cat-wrap">
								<select id="select_category" name="category">
									<option hidden value="">请选择分类</option>
								</select>
								<span><i class="fa fa-angle-down" aria-hidden="true"></i></span>
								<div class="all-categories">
									<div class="cat-list-search">
										<!-- 1级菜单 -->
										<ldbz:category_tag level="1" fid="1" ;category>
											<div class="title"  cid="${category.id}">${category.categoryName}</div>
										</ldbz:category_tag>
									</div><!-- /.cat-list-search -->
								</div><!-- /.all-categories -->
							</div><!-- /.cat-wrap -->
							<div class="box-search">
								<input type="text" name="search" placeholder="输入关键字检索商品">
								<span class="btn-search">
									<button id="btn_global_search" type="button" class="waves-effect"><img src="${request.contextPath}/portal/images/icons/search.png" alt=""></button>
								</span>
							</div><!-- /.box-search -->
						</form><!-- /.form-search -->
					</div><!-- /.top-search -->
				</div><!-- /.col-md-6 -->
				<div class="col-md-3">
					<div class="box-cart">
						<div class="inner-box">
							<ul class="menu-compare-wishlist">
								<li class="compare">
									<a href="javascript:;" title="">
										<img src="${request.contextPath}/portal/images/icons/compare.png" alt="">
									</a>
								</li>
								<li class="wishlist">
									<a href="${request.contextPath}/wishlist" title="">
										<img src="${request.contextPath}/portal/images/icons/wishlist.png" alt="">
									</a>
								</li>
							</ul><!-- /.menu-compare-wishlist -->
						</div><!-- /.inner-box -->
						<div name="div_show_cart" class="inner-box">
							<a href="javascript:;" title="购物车">
								<div class="icon-cart">
									<img src="${request.contextPath}/portal/images/icons/cart.png" alt="">
									<span id="span_cart_itemcount" style="display:none;"></span>
								</div>
							</a>
							<div class="dropdown-box">
								<ul id="ul_items"></ul>
								<div class="total">
									<span>总价:</span>
									<span class="price" id="span_cart_itemprice">￥0</span>
								</div>
								<div class="btn-cart">
									<a href="${request.contextPath}/cart" class="view-cart" title="">查看</a>
									<a href="shop-checkout.html" class="check-out" title="">结算</a>
								</div>
							</div>
						</div><!-- /.inner-box -->
					</div><!-- /.box-cart -->
				</div><!-- /.col-md-3 -->
			</div><!-- /.row -->
		</div><!-- /.container -->
	</div><!-- /.header-middle -->
	<div class="header-bottom">
		<div class="container">
			<div class="row">
				<div class="col-md-3 col-2">
					<div id="mega-menu">
						<div class="btn-mega"><span></span>商品分类</div>
						<ul class="menu">
						<!-- 1级菜单 -->
						<ldbz:category_tag level="1" fid="1" ;category>
							<li>
								<a href="javascript:;" title="" class="dropdown">
									<span class="menu-img">
										<img src="${request.contextPath}/portal/images/icons/menu/01.png" alt="">
									</span>
									<span class="menu-title">${category.categoryName}</span>
								</a>
								<div class="drop-menu">
									<!-- 2级菜单 -->
									<ldbz:category_tag level="2" fid="${category.id}" ;category2>
									<div class="one-third">
										<div class="cat-title">${category2.categoryName}</div>
										<ul>
											<!-- 3级菜单 -->
											<ldbz:category_tag level="3" fid="${category2.id}" ;category3>
												<li><a href="${request.contextPath}/search?category=${category.id}&cid=${category3.id}" title="">${category3.categoryName}</a></li>
											</ldbz:category_tag>
										</ul>
										<!-- <div class="show">
											<a href="javascript:;" title="">更多</a>
										</div> -->
									</div>
									</ldbz:category_tag>
								</div>
							</li>
							</ldbz:category_tag>
						</ul>
					</div>
				</div><!-- /.col-md-3 -->
				<div class="col-md-9 col-10">
					<div class="nav-wrap">
						<div id="mainnav" class="mainnav">
							<ul class="menu">
								<!-- 1级菜单 -->
								<ldbz:category_tag level="1"  fid="1" ;category>
								<li class="has-mega-menu">
									<a href="javascript:;" title="">${category.categoryName}</a>
									<div class="submenu">
										<div class="row">
												<!-- 2级菜单 -->
												<ldbz:category_tag level="2" fid="${category.id}" ;category2>
													<div class="col-lg-3 col-md-12">
														<h3 class="cat-title">${category2.categoryName}</h3>
														<ul class="submenu-child">
															<!-- 3级菜单 -->
															<ldbz:category_tag level="3" fid="${category2.id}" ;category3>
																<li><a href="${request.contextPath}/search?category=${category.id}&cid=${category3.id}" title="">${category3.categoryName}</a></li>
															</ldbz:category_tag>
														</ul>
														<!-- <div class="show">
															<a href="javascript:;" title="">更多</a>
														</div> -->
													</div>
												</ldbz:category_tag>
										</div>
									</div>
								</li>
								</ldbz:category_tag>
							</ul><!-- /.menu -->
						</div><!-- /.mainnav -->
					</div><!-- /.nav-wrap -->
					<div class="btn-menu">
                           <span></span>
                       </div><!-- //mobile menu button -->
				</div><!-- /.col-md-9 -->
			</div><!-- /.row -->
		</div><!-- /.container -->
	</div><!-- /.header-bottom -->
</section><!-- /#header -->
<script>
$(function(){

	
	//切换分类
	$(".cat-list-search div").click(function(){
		var cid = $(this).attr("cid");
		var cid_text = $(this).text();

		$("#select_category").empty();
		$("#select_category").html("<option hidden selected value='" + cid + "'>" + cid_text + "</option>");
	});

	
	//提交查询
	$("#btn_global_search").click(function(){
		var key = $("#input_serch").val();
		var cid = $("#select_category").val();
		if(!cid){
			jqueryAlert({
			    'icon'    : '${request.contextPath}/portal/alert/img/warning.png',
			    'content' : '请选择分类',
			    'closeTime' : 2000,
			}).show();
			return ;
		}
		
		$("#form_global_search")[0].submit();
	});
	
})
</script>